<%--
  Created by IntelliJ IDEA.
  User: 谢兴鑫
  Date: 2022/4/26
  Time: 下午 02:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ajaxForm.js"></script>

</head>
<script>
    layui.use(['form', 'laydate', 'layer'], function () {
        var form = layui.form, laydate = layui.laydate, layer = layui.layer;


        //自定义验证规则
        form.verify({
            account: function(value, item){
                var min = item.getAtztribute('lay-min');
                if(value.length >= 3){
                    return '不能超过'+2+'位数';
                }
            },
            account1: function(value, item){
                var min = item.getAttribute('lay-min');
                if(value.length >= 4){
                    return '不能超过'+3+'位数';
                }
            },
            newmobile: function(value){
                if(value.length != 3){
                    return '只能输入三位数';
                }
            },
            chineseName: function (value) {
                let pattern = /[\u4e00-\u9fa5]/;//中文验证
                let txt = pattern.test(value);

                if (value.length < 1 || !txt) {
                    return '必须要有中文';
                }
            },
            // v_pass:[/^[\s]{1,3}$/,'长度不能超过三位数'],
            numberRequiredFalse:[/(^$)|^\d+$/,'只能填写数字'],//非必填项，填了就会进行验证
            username: function (value, item) { //value：表单的值、item：表单的DOM对象
                if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
                    return '不能有特殊字符';
                }
                if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '首尾不能出现下划线\'_\'';
                }

            }
        });

        $(function () {
            form.val('formsbt',${aduitlog});//将对象赋给表单，自动赋值
            form.render();
        });

        form.on('submit(formBtn)',function(data){
            var formData = new FormData($("#formsbt")[0]);
            $.ajax({
                url:'${pageContext.request.contextPath}/kaohe/ygkhupd',
                type : 'POST',
                data : formData,
                cache: false,
                async: false,
                processData : false,  //必须false才会避开jQuery对 formdata 的默认处理
                contentType : false,  //必须false才会自动加上正确的Content-Type
                success:function(data){
                    layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框
                    setTimeout(function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭弹出层
                        parent.location.reload();//重新加载父页面表格
                    }, 1100);
                }
            })
            return false;
        });

    });
</script>
<body>
<form class="layui-form" id="formsbt"  lay-filter="formsbt">

    <%--     考核指标--%>
    <div class="layui-form-item">
        <input type="hidden" name="aduitLogId">
        <label class="layui-form-label">考核指标：</label>
        <div class="layui-input-inline">
            <select name="aduitModelId">
                <c:forEach items="${aduitmodels}" var="s">
                    <option value="${s.aduitModelId}">${s.aduitName}</option>
                </c:forEach>
            </select>
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">员工：</label>
        <div class="layui-input-inline">
            <select name="empId">
                <c:forEach items="${emps}" var="s">
                    <option value="${s.empId}">${s.empName}</option>
                </c:forEach>
            </select>
        </div>
    </div>


    <%--    分数--%>
    <div class="layui-form-item">
        <label class="layui-form-label" >评分：</label>
        <div class="layui-input-inline">
            <%--            <input type="text" name="scores" class="layui-input" placeholder="请输入评分" lay-verify="required"/>--%>
            <select name="scores" lay-verify="required">
                <option value="">请选择</option>
                <optgroup label="扣分项">
                    <option value="-5">-5</option>
                    <option value="-10">-10</option>
                    <option value="-15">-15</option>
                    <option value="-20">-20</option>
                </optgroup>
                <optgroup label="加分项">
                    <option value="5">+5</option>
                    <option value="10">+10</option>
                    <option value="15">+15</option>
                </optgroup>
            </select>
        </div>
        <span style="font-size: 10px;color: red">※</span>
    </div>


    <%--        说明--%>
    <div class="layui-form-item">
        <label class="layui-form-label">说明：</label>
        <div class="layui-input-inline">
            <%--            <input type="text" name="remark" class="layui-input" placeholder="不用太详细" lay-verify="required|v_notallnum|v_pass"/>--%>
            <textarea name="remark" class="layui-input" style="width: 200px;height: 100px" placeholder="说明字数10-500字" lay-verify="required|v_notallnum|v_pass"></textarea>

        </div>
        <span style="font-size: 10px;color: red">※</span>
    </div>

    <%--    入录人员--%>
    <input type="hidden" name="auditPerson" value="${sessionScope.emp.empName}">


    <%--        提交--%>

    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <button class="layui-btn" lay-submit lay-filter="formBtn">修改</button>
        </div>
    </div>
</form>
<script>
</script>
</body>
</html>